package cn.fotoit.product.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class PasswordUtil {
    public static String getPasswordByUsernameAndPassword(String name, String password) {
        Object salt = ByteSource.Util.bytes( name );
        int hashIterations = 1024;// 加密次数
        Object result = new SimpleHash( "MD5", password, salt, hashIterations );
        return result.toString();
    }

    public static void main(String[] args) {
        System.out.println( getPasswordByUsernameAndPassword( "admin", "111111" ) );
    }
}
